﻿using UnityEngine;
using System.Collections;
namespace FSM
{
    public class AndNode:ListNode
    {
        protected override bool OnUpdate()
        {
            //var b = base.OnUpdate();
            for(int i = index, length = list.Count;i < length;i++)
            {
                var it = list[i];
                if(it.Update())
                {
                    index = i + 1;
                }
                else
                {
                    return false;
                }
            }
            /*foreach(var it in list)
            {
                if(!it.Update())
                {
                    return false;
                }
            }*/
            return true;
        }
    }
}
